package com.szp.lagou.mq.rocketmq.service;

import com.szp.lagou.mq.rocketmq.dao.OrderDao;
import com.szp.lagou.mq.rocketmq.pojo.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {
    @Autowired
    OrderDao orderDao;

    public void updateOrderStatusById(String id, String status) {
        orderDao.updateOrderStatusById(id, status);
    }

    public void payOrder(String id) {
        orderDao.updateOrderStatusById(id, "1");
    }

    public List<Order> getUnPayOrders(int count) {
        return orderDao.getUnPayOrders(count);
    }

    public void saveOrder(Order order) {
        orderDao.addOrder(order);
    }
}
